package com.smartum.mpr.model;

import java.util.Set;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.map.annotate.JsonSerialize;

import com.smartum.mpr.json.deserializers.ItemTypeDeserializer;
import com.smartum.mpr.json.parsers.CountyParser;
import com.smartum.mpr.json.serializers.CountySerializer;
import com.smartum.mpr.json.serializers.ItemSubCategorySerializer;
import com.smartum.mpr.json.serializers.ItemTypeSerializer;
import com.smartum.mpr.json.serializers.UserSerializer;

public class Item extends Identify {

	private static final long serialVersionUID = 1L;

	@JsonProperty("item_title")
	private String title;
	@JsonProperty("item_description")
	private String description;
	@JsonProperty("item_cost")
	private Double cost;
	@JsonProperty("item_timestamp")
	private long timeStamp;
	@JsonProperty("item_phone_number")
	private String phoneNumber;
	@JsonProperty("item_images")
	private Set<ItemImage> itemImages;
	@JsonProperty("user")
	private User owner;
	@JsonProperty("item_category")
	@JsonSerialize(using=ItemSubCategorySerializer.class)
	private ItemSubCategory subCategory;
	@JsonSerialize(using = CountySerializer.class)
	private County county;
	@JsonDeserialize(using = ItemTypeDeserializer.class)
	@JsonSerialize(using = ItemTypeSerializer.class)
	@JsonProperty("item_type")
	private ItemType itemType;
	@JsonProperty("item_email")
	private String itemEmail;

	public Item() {

	}

	public ItemType getItemType() {
		return itemType;
	}

	public void setItemType(ItemType itemType) {
		this.itemType = itemType;
	}

	public String getItemEmail() {
		return itemEmail;
	}

	public void setItemEmail(String itemEmail) {
		this.itemEmail = itemEmail;
	}

	public ItemSubCategory getSubCategory() {
		return subCategory;
	}

	public void setSubCategory(ItemSubCategory subCategory) {
		this.subCategory = subCategory;
	}

	@JsonProperty("item_location")
	public County getCounty() {
		return county;
	}

	@JsonProperty("county")
	public void setCounty(County county) {
		this.county = county;
	}

	public User getOwner() {
		return owner;
	}

	public void setOwner(User owner) {
		this.owner = owner;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Double getCost() {
		return cost;
	}

	public void setCost(Double cost) {
		this.cost = cost;
	}

	public long getTimeStamp() {
		return timeStamp;
	}

	public void setTimeStamp(long timeStamp) {
		this.timeStamp = timeStamp;
	}

	public String getPhoneNumber() {
		return phoneNumber;
	}

	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}

	public Set<ItemImage> getItemImages() {
		return itemImages;
	}

	public void setItemImages(Set<ItemImage> itemImages) {
		this.itemImages = itemImages;
	}

	@Override
	@JsonProperty("item_id")
	public Long getId() {
		return super.getId();
	}

	@Override
	@JsonProperty("item_id")
	public void setId(Long id) {
		super.setId(id);
	}

}
